var JasmineAjax = {};
JasmineAjax.request = BROWSER.isIE ? new ActiveXObject ("Microsoft.XMLHTTP") : new XMLHttpRequest ();
JasmineAjax.send = function (name, method, parameters, onload, onerror, oncleanup) {
    var request = JasmineAjax.request;
//    if (!name.endsWith('.ajax')) name += '.ajax';
    var requestMethod = (method || "get").toUpperCase();
    if (requestMethod == "GET") name += "?" + parameters;
    request.open (requestMethod, name);
    if (requestMethod == "POST")
        request.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
    request.onreadystatechange = function () {
        if (request.readyState == 4) {
            try {
                switch (request.status) {
                    case 200 :
                        if (onload) onload (request);
                        break;
                    case 404 :
                        alert ("找不到服务：" + name);
                        break;
                    case 405 :
                        alert ("Http Request Method [" + requestMethod + "] NOT ALLOWED!");
                        break;
                    case 406 :
                        alert (name + " is NOT a Jasmine Ajax Service!");
                        break;
                    default :
                        alert (request.status);
                        break;
                }
            } catch (E) {
                if (onerror) onerror (request);
            } finally {
                if (oncleanup) oncleanup (request);
            }
        }
    };
    request.send (requestMethod == "POST" ? parameters : null);
};